<div *ngIf="data">
  <nz-card class="interface-base" nzNoHovering>
    <ng-template #title>
      <div class="method method-{{data.method}}">{{data.method}}</div>
      <div class="title-url">{{data.url}}</div>
    </ng-template>
    <ng-template #extra>
      {{data.summary}}
    </ng-template>
    <ng-template #body>
      {{data.description}}
    </ng-template>
  </nz-card>

  <!-- 请求参数 -->
  <nz-card class="m-t-16" nzNoHovering>
    <ng-template #title>
      请求参数
    </ng-template>
    <ng-template #extra>
      <ng-container *ngIf="data.consumes && data.consumes.length > 0">
        {{data.consumes[0]}}
      </ng-container>
    </ng-template>
    <ng-template #body>
      <nz-table #nzTable [nzDataSource]="data.parameters" [nzIsPagination]="false">
        <thead nz-thead>
          <tr>
            <th nz-th nzExpand></th>
            <th nz-th>参数</th>
            <th nz-th>必填</th>
            <th nz-th>参数类型</th>
            <th nz-th>数据类型</th>
            <th nz-th>描述</th>
            <th nz-th>默认值</th>
          </tr>
        </thead>
        <tbody nz-tbody>
          <ng-template ngFor let-row [ngForOf]="nzTable.data">
            <tr nz-tbody-tr>
              <td nz-td nzExpand>
                <nz-row-expand-icon [(nzExpand)]="row.expand" *ngIf="hasRef(row)"></nz-row-expand-icon>
              </td>
              <td nz-td>{{row.name}}</td>
              <td nz-td>{{row.required}}</td>
              <td nz-td>{{row.in}}</td>
              <td nz-td>{{getType(row)}}</td>
              <td nz-td>{{row.description}}</td>
              <td nz-td>{{row.default}}</td>
            </tr>
            <tr nz-tbody-tr *ngIf="row.expand" class="hover-no-back-tr">
              <td nz-td colspan="7" style="padding: 0;">
                <swagger-ref-item [ref]="getType(row)"></swagger-ref-item>
              </td>
            </tr>
          </ng-template>
        </tbody>
      </nz-table>
    </ng-template>
  </nz-card>
  <!-- 返回数据 -->
  <nz-card class="m-t-16" nzNoHovering>
    <ng-template #title>
      返回数据
    </ng-template>
    <ng-template #extra>
      {{data.produces[0]}}
    </ng-template>
    <ng-template #body>
      TODO: 关联数据模型，多个数据模型tabset（model/model schema)
      <br>
      <br> {{data.responses['200'].schema.$ref}}
    </ng-template>
  </nz-card>
</div>
